package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AStepMapper;
import com.ruoyi.system.domain.AStep;
import com.ruoyi.system.service.IAStepService;

/**
 * 工序台账Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-16
 */
@Service
public class AStepServiceImpl implements IAStepService 
{
    @Autowired
    private AStepMapper aStepMapper;

    /**
     * 查询工序台账
     * 
     * @param id 工序台账主键
     * @return 工序台账
     */
    @Override
    public AStep selectAStepById(Long id)
    {
        return aStepMapper.selectAStepById(id);
    }

    /**
     * 查询工序台账列表
     * 
     * @param aStep 工序台账
     * @return 工序台账
     */
    @Override
    public List<AStep> selectAStepList(AStep aStep)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aStep.setGroupId(deptId.toString());
        return aStepMapper.selectAStepList(aStep);
    }

    /**
     * 新增工序台账
     * 
     * @param aStep 工序台账
     * @return 结果
     */
    @Override
    public int insertAStep(AStep aStep)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aStep.setGroupId(deptId.toString());
        return aStepMapper.insertAStep(aStep);
    }

    /**
     * 修改工序台账
     * 
     * @param aStep 工序台账
     * @return 结果
     */
    @Override
    public int updateAStep(AStep aStep)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aStep.setGroupId(deptId.toString());
        return aStepMapper.updateAStep(aStep);
    }

    /**
     * 批量删除工序台账
     * 
     * @param ids 需要删除的工序台账主键
     * @return 结果
     */
    @Override
    public int deleteAStepByIds(Long[] ids)
    {
        return aStepMapper.deleteAStepByIds(ids);
    }

    /**
     * 删除工序台账信息
     * 
     * @param id 工序台账主键
     * @return 结果
     */
    @Override
    public int deleteAStepById(Long id)
    {
        return aStepMapper.deleteAStepById(id);
    }
}
